package com.itjoyee.redis.benchmark.redisson;

import org.redisson.api.RList;
import org.redisson.api.RedissonClient;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import com.itjoyee.redis.benchmark.base.Bench;
import com.itjoyee.redis.benchmark.base.Benchmark;

/**
 *
 */
public class ListAddBenchmark {

    public static void main(String[] args) throws InterruptedException {
        Bench<RedissonClient> bench = new RedissonBench() {
            @Override
            public void executeOperation(String data, RedissonClient benchInstance, int threadNumber, int iteration,
                    MetricRegistry metrics) {
                RList<String> list = benchInstance.getList("list_" + threadNumber);

                Timer.Context time = metrics.timer("list").time();
                list.add(data);
                time.stop();
            }
        };
        
        Benchmark benchmark = new Benchmark(bench);
        benchmark.run(args);
    }
    
}
